package com.minhua.jijiehao2.mainframe.creditcard.creditcardfragment.impl

import com.minhua.jijiehao2.base.BaseMvpPresenter
import com.minhua.jijiehao2.bean.BaseBean
import com.minhua.jijiehao2.bean.CreditCardBean
import com.minhua.jijiehao2.constants.DefineKey
import com.minhua.jijiehao2.http.CallBack
import com.minhua.jijiehao2.http.ParamsMap
import com.minhua.jijiehao2.mainframe.creditcard.creditcardfragment.imp.ICreditCardPresenter
import com.minhua.jijiehao2.mainframe.creditcard.creditcardfragment.imp.ICreditCardView

class CreditCardPresenter : BaseMvpPresenter<ICreditCardView>(), ICreditCardPresenter {

    private var mCreditCardModel = CreditCardModel()

    override fun getTopList() {
        val map = ParamsMap()
        map.put(DefineKey.SHOW_TYPE, DefineKey.SHOW_TYPE_TOP)
        mCreditCardModel.getCreditCardList(map, object : CallBack<List<CreditCardBean>>() {
            override fun onSuccess(t: BaseBean<List<CreditCardBean>>) {
                v?.onTopSuccess(t.data!!)
            }
        })
    }

    override fun getNormalList() {
        val map = ParamsMap()
        map.put(DefineKey.SHOW_TYPE, DefineKey.SHOW_TYPE_NORMAL)
        mCreditCardModel.getCreditCardList(map, object : CallBack<List<CreditCardBean>>() {
            override fun onSuccess(t: BaseBean<List<CreditCardBean>>) {
                v?.onNormalSuccess(t.data!!)
            }
        })
    }
}